package TestModel;

import java.util.LinkedList;
import java.util.Random;

import DataModel.CommonLibrary.CommonDefs.Layer;
import DataModel.LayoutManager.CLayoutManager;
import DataModel.LayoutManager.CRectangle;
import DataModel.LayoutManager.CRectanglesSortedList;
import junit.framework.TestCase;

public class LayoutManagerTest extends TestCase 
{

	/***************************************************/
	/****** Members ************************************/
	/***************************************************/
	LinkedList<CRectangle> recsList = new LinkedList<CRectangle>();
	CRectangle rec0 = new CRectangle(2,5,4,10,Layer.Metal1,0);
	CRectangle rec1 = new CRectangle(3,6,10,11,Layer.Metal2,1);
	CRectangle rec2 = new CRectangle(8,7,9,8,Layer.Via1_2,2);
	CRectangle rec3 = new CRectangle(7,4,10,12,Layer.Metal1,3);
	CRectangle rec4 = new CRectangle(6,2,11,5,Layer.Metal3,4);
	CRectangle rec5 = new CRectangle(3,1,12,3,Layer.Metal1,5);
	
	
	/***************************************************/
	/****** C'tors *************************************/
	/***************************************************/
	public LayoutManagerTest()
	{
		recsList.add(rec0);
		recsList.add(rec1);
		recsList.add(rec2);
		recsList.add(rec3);
		recsList.add(rec4);
		recsList.add(rec5);
	}
	
	/***************************************************/
	/****** Methods ************************************/
	/***************************************************/
	public void testCLayoutManager() 
	{
		System.out.println("Hello layout manager test\n");
		
		CLayoutManager layoutMan = new CLayoutManager(recsList);
		
		CRectanglesSortedList recsXSortedList = layoutMan.GetXSorted();
		CRectanglesSortedList recsYSortedList = layoutMan.GetYSorted();
		
		System.out.println("X sorted recs\n");
		for (CRectangle xRec : recsXSortedList.GetRecsSortedList()) {
			System.out.println(xRec.getLeftEdge().getStartPoint().x);
		}
		
		System.out.println("Y sorted recs\n");
		for (CRectangle yRec : recsYSortedList.GetRecsSortedList()) {
			System.out.println(yRec.getBottomEdge().getStartPoint().y);
		}
	}
}
